#include "runner.hpp"

int i_init(int argc, char ** argv)
{
	Runner::_logger << "i_init" << std::endl;
	return 0;
}

int i_proc()
{
	Runner::_logger << "i_proc" << std::endl;
	sleep(1);
	return 0;
}

int i_reload()
{
	Runner::_logger << "i_reload" << std::endl;
	return 0;
}

int i_finish()
{
	Runner::_logger << "i_finish" << std::endl;
	return 0;
}

int main(int argc, char * argv[])
{
	Runner runner;

	runner._init     = i_init;
	runner._proc     = i_proc;
	runner._reload   = i_reload;
	runner._finish   = i_finish;

	if (runner.init(argc, argv) < 0)
	{
		Runner::_logger << "Runner initialize failed." << std::endl;
		return 0;
	}

	Runner::openlog();

	char buff[256] = "";

	if (getcwd(buff, sizeof(buff) - 1) != NULL)
	{
		Runner::_logger << "pwd: " << buff << std::endl;
	}
	else
	{
		Runner::_logger << "getcwd failed." << std::endl;
	}

	runner.start();

	Runner::closelog();

	return 0;
}

